#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

void solve(){
    int n;
    cin>>n;
    vector<int> a(n);
    ll res=0;
    for(int i=0;i<n;i++){
    	cin>>a[i];
    	ll l=0,r=1e8;
    	while(l<r){
    		ll mid=(l+r)/2LL;
    		ll temp=mid*(mid+1LL)/2;
    		if(temp>=a[i]){
    			r=mid;
    		}else{
    			l=mid+1LL;
    		}
    	}
    	res+=l;
        cout<<l<<'\n';
    }
    cout<<res<<'\n';
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}